home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / tcl / tcl70b2.lha / tcl7.0b2 / tests / cmdinfo.test < prev    next >
Text File  |  1993-07-01  |  3KB  |  80 lines

  1. # Commands covered:  none
  2. #
  3. # This file contains a collection of tests for Tcl_GetCommandInfo,
  4. # Tcl_SetCommandInfo, Tcl_CreateCommand, and Tcl_DeleteCommand.
  5. # Sourcing this file into Tcl runs the tests and generates output for
  6. # errors.  No output means no errors were found.
  7. #
  8. # Copyright (c) 1993 The Regents of the University of California.
  9. # All rights reserved.
  10. #
  11. # Permission is hereby granted, without written agreement and without
  12. # license or royalty fees, to use, copy, modify, and distribute this
  13. # software and its documentation for any purpose, provided that the
  14. # above copyright notice and the following two paragraphs appear in
  15. # all copies of this software.
  16. #
  17. # IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
  18. # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  19. # OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  20. # CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21. #
  22. # THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  23. # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  24. # AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  25. # ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  26. # PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  27. #
  28. # $Header: /user6/ouster/tcl/tests/RCS/cmdinfo.test,v 1.1 93/07/01 16:23:09 ouster Exp $ (Berkeley)
  29.  
  30. if {[info commands testcmdinfo] == {}} {
  31.     puts "This application hasn't been compiled with the \"testcmdinfo\""
  32.     puts "command, so I can't test Tcl_GetCommandInfo etc."
  33.     return
  34. }
  35.  
  36. if {[string compare test [info procs test]] == 1} then {source defs}
  37.  
  38. test cmdinfo-1.1 {command procedure and clientData} {
  39.     testcmdinfo create x1
  40.     testcmdinfo get x1
  41. } {CmdProc1 original CmdDelProc1 original}
  42. test cmdinfo-1.2 {command procedure and clientData} {
  43.     testcmdinfo create x1
  44.     x1
  45. } {CmdProc1 original}
  46. test cmdinfo-1.3 {command procedure and clientData} {
  47.     testcmdinfo create x1
  48.     testcmdinfo modify x1
  49.     testcmdinfo get x1
  50. } {CmdProc2 new_command_data CmdDelProc2 new_delete_data}
  51. test cmdinfo-1.4 {command procedure and clientData} {
  52.     testcmdinfo create x1
  53.     testcmdinfo modify x1
  54.     x1
  55. } {CmdProc2 new_command_data}
  56.  
  57. test cmdinfo-2.1 {command deletion callbacks} {
  58.     testcmdinfo create x1
  59.     testcmdinfo delete x1
  60. } {CmdDelProc1 original}
  61. test cmdinfo-2.2 {command deletion callbacks} {
  62.     testcmdinfo create x1
  63.     testcmdinfo modify x1
  64.     testcmdinfo delete x1
  65. } {CmdDelProc2 new_delete_data}
  66.  
  67. test cmdinfo-3.1 {Tcl_Get/SetCommandInfo return values} {
  68.     testcmdinfo get non_existent
  69. } {??}
  70. test cmdinfo-3.2 {Tcl_Get/SetCommandInfo return values} {
  71.     testcmdinfo create x1
  72.     testcmdinfo modify x1
  73. } 1
  74. test cmdinfo-3.3 {Tcl_Get/SetCommandInfo return values} {
  75.     testcmdinfo modify non_existent
  76. } 0
  77.  
  78. catch {rename x1 ""}
  79. concat {}
  80.